﻿#region License

using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Media;
using HitTEST.DomainSpecific.Sdk;
using Microsoft.Practices.Composite.Events;
using Microsoft.Practices.ServiceLocation;
using pushbomb.composite.core;

#endregion

namespace DynamicLayoutModuleView
{
    public class HitTestItem : ViewModelBase<SampleControl>, IHitTestItem {
        private Color _itemBaseColor;


        public HitTestItem( IServiceLocator sl, SampleControl v, IEventAggregator ea) : base(sl, v, ea)
        {
            View = v;
            if (View != null) View.DataContext = this;



           // e.Subscribe(SendNewControlCount);
        }

        #region IHitTestItem Members

        public Color ItemBaseColor
        {
            get { return _itemBaseColor; }
            set
            {
                _itemBaseColor = value;
                ItemColor = new SolidColorBrush(_itemBaseColor);
            }
        }

        #endregion

        private void SendNewControlCount(double obj)
        {
        }

        #region ItemColor Dependency Property

        /// <summary>
        /// ItemColor Dependency Property.
        /// </summary>
        public static readonly DependencyProperty ItemColorProperty =
            DependencyProperty.Register(
                "ItemColor",
                typeof (SolidColorBrush),
                typeof (HitTestItem),
                new PropertyMetadata(new SolidColorBrush(Colors.White)));

 

        /// <summary>
        /// 
        /// </summary>
        public SolidColorBrush ItemColor
        {
            get { return (SolidColorBrush) GetValue(ItemColorProperty); }
            set
            {
                SetValue(ItemColorProperty, value);

                InvokePropertyChanged(new PropertyChangedEventArgs("ItemColor"));
            }
        }

    



        #endregion

        #region ItemDescription Dependency Property

        /// <summary>
        /// ItemDescription Dependency Property.
        /// </summary>
        public static readonly DependencyProperty ItemDescriptionProperty =
            DependencyProperty.Register(
                "ItemDescription",
                typeof (String),
                typeof (HitTestItem),
                null);

        private readonly NumerberViewRegionItemsChange e;


        /// <summary>
        /// 
        /// </summary>
        public String ItemDescription
        {
            get { return (String) GetValue(ItemDescriptionProperty); }
            set
            {
                SetValue(ItemDescriptionProperty, value);

                InvokePropertyChanged(new PropertyChangedEventArgs("ItemDescription"));
            }
        }

        #endregion

        IView IViewModel<IView>.View
        {
            get { return View;}
            set { View = value as SampleControl; }
        }
    }
}